package com.youlu.campus.service.system.impl;

import com.alibaba.fastjson.JSON;
import com.youlu.campus.entity.SystemOptLog;
import com.youlu.campus.service.system.SystemOptLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.Date;

@Slf4j
@Service
public class SystemOptLogServiceImpl implements SystemOptLogService {
    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void create(SystemOptLog data) {
        log.info(":>>> 开始创建操作日志:{}", JSON.toJSON(data));
        data.setId(null);
        data.setCreatedTime(new Date());
        mongoTemplate.insert(data);
    }
}
